package index.array;

public class CopyArray {
    public static void main(String[] args) {
        //测试 空数组测试
        int []arr1=new int[0];
        //方法返回值赋值
        arr1=copyArray(arr1);
        //遍历arr1;
        //for
        for (int i = 0; i <=arr1.length-1 ; i++) {
            System.out.println(arr1[i]);
        }
        //foreach
        for(int item :arr1){
            System.out.println(item);
        }
    }
    public static int [] copyArray(int []arr){
        int []CopyArr=new int []{1,2,3};
        arr=CopyArr;
        return arr;
    }
}
